Public Class LookupDataListDialog
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents lbLKD As System.Web.UI.WebControls.ListBox

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Page.IsPostBack Then
            Dim lkID As Integer
            Try
                lkID = CInt(Request.QueryString("id"))
            Catch ex As Exception
                lkID = 0
            End Try

            If Not (lkID > 0) Then
                Throw New ApplicationException("invalid or missing parameter")
            End If

            Dim textField As String

            textField = Request.QueryString("t")            

            If textField.Trim = "" Then
                Throw New ApplicationException("invalid or missing parameter")
            End If

            Me.lbLKD.DataSource = CLookup.GetLookupDataList(lkID)
            Me.lbLKD.DataTextField = "VALUE" & textField
            Me.lbLKD.DataValueField = "LKD_ID_PK"

            Me.DataBind()
        End If
    End Sub

End Class
